Skip to content

Fix firefox new tab perm - #3118

Open
matthewsong18 wants to merge 2 commits into
dteviot:ExperimentalTabModefrom
matthewsong18:fix-firefox-new-tab-perm
Open

matthewsong18 wants to merge 2 commits into
dteviot:ExperimentalTabModefrom
matthewsong18:fix-firefox-new-tab-perm

Conversation

@matthewsong18

@matthewsong18 matthewsong18 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Problem

User was encountering missing host permission error on Firefox-based brower due to opening extension on a protected firefox page (new-tab). This was due to firefox not allowing script injecting on protected pages.

Fix

  • Found that on protected pages, such as new tab, extensions, and settings, the url is undefined when read on both chrome and firefox. Using this behavior, I made the injectContentScript() function return early if it could not read the url.
  • I also found a bug in the chromeInjectContentScript() function. It was sending unhandled errors to the browser console while I was checking chrome's behavior to opening the extension on a new tab or any protected page. The errors are now handled and displayed properly by WebToEpub. But the error is now unreachable since I return if the browser can't read the url (since the error was being unable to read the url lol).

Fixes #3117

Return the injection promise through both helpers so getActiveTabDOM can
catch asynchronous failures instead of leaving unhandled rejections.
Read the source tab before injecting. When its URL is unavailable, leave
WebToEpub open without loading page content.

This avoids the missing host permission error on Firefox's New Tab page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing Host Permission

1 participant